package com.bxs.sniffer;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bxs.mapper.FilterRuleMapper;
import com.bxs.pojo.FilterRule;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author dream
 * @title: FilterManager
 * @projectName ids_v0_2
 * @description: TODO
 */
@Component
@Slf4j
public class FilterManager {
//    private List<BasePacketFilter> filters = new ArrayList<>();
    @Autowired
    FilterRuleMapper filterRuleMapper;


    // 获取数据包抓取的过滤规则
    public List<FilterRule> getFilters(QueryWrapper<FilterRule> queryWrapper){
        System.out.println("get filter rule" + filterRuleMapper);
        List<FilterRule> filterRules = null;
        try{
            filterRules = filterRuleMapper.selectList(queryWrapper);
        }catch (Exception e){
            log.error(e.getMessage(), e);
        }
        return filterRules;
    }
}
